package demo;

import demo.hardware.impl.Cpu;
import demo.hardware.impl.Disk;
import demo.software.ISoftwareVisitor;

/**
 * @author ZhouWeiBo
 * @create 2022/6/8
 */
public class MyRobot {
    private Cpu cpu;
    private Disk disk;

    public void calc(){
        System.out.println(cpu.command);
    }

    public void updateSystem(ISoftwareVisitor softwareVisitor){
        System.out.println("系统正在升级中~");
        softwareVisitor.visitCpu(cpu);
        softwareVisitor.visitDisk(disk);
        System.out.println("系统已升级完毕！");
    }

    public Cpu getCpu() {
        return cpu;
    }

    public void setCpu(Cpu cpu) {
        this.cpu = cpu;
    }

    public Disk getDisk() {
        return disk;
    }

    public void setDisk(Disk disk) {
        this.disk = disk;
    }

    public MyRobot(Cpu cpu, Disk disk) {
        this.cpu = cpu;
        this.disk = disk;
    }
}
